<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

<head>
<meta charset="utf-8">
<title>SMM撮合系统</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="" name="description">
<meta content="" name="author">
<link href="${request.getContextPath()}/Public/assets/admin/css/css.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/global/css/components-rounded.css" id="style_components" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/css/plugins.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/layout.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color">
<link href="${request.getContextPath()}/Public/assets/admin/css/custom.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/admin/css/common.css" rel="stylesheet" type="text/css">

<link rel="shortcut icon" href="${request.getContextPath()}/Public/favicon.ico">
<link href="${request.getContextPath()}/Public/css/client.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/css/page1.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/css/kkpager.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/css/customerDetail.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${request.getContextPath()}/Public/My97DatePicker/WdatePicker.js"></script>
<script>
	BASE_URL = '${request.getContextPath()}'
</script>
</head>

<body class="page-header-top-fixed">
<!--头部信息结束 -->
<div class="page-header">
	<!--头部开始-->
	<#include "/include/top.html" />
	<!-- 头部信息结束 -->


	<!-- 头部菜单开始 -->
	<#include "/include/top_menu.html" />
	<!-- 头部菜单结束 -->
</div>
<!-- END HEADER -->

		<!-- BEGIN PAGE CONTAINER -->
<div class="page-container">
	<!-- 内容开始 -->
	<div class="page-content">
		<div class="container-fluid">
			<!-- 当前位置提示开始 -->
			<ul class="page-breadcrumb breadcrumb">
				<li>
					<a href="#">首页</a><i class="fa fa-circle"></i>
				</li>
				<li class="active">
					 撮合管理<i class="fa fa-circle"></i>
				</li>
				
				
				<li class="active">
					 洽谈管理
				</li>
				
			</ul>
			<!-- 当前位置提示结束 -->
			<div class="row margin-top-10">
				<div class="col-md-12">
					<div class="portlet light bordered">
						<div class="portlet-body" style="height: 13px;padding-top: 2px">
							<div style="float: left;">
									视图：
									<a href="${request.getContextPath()}/chats/chatsList.do" id="allClient">全部</a> |
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=6" id="deptClient">我的创建</a>|
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=7" id="deptClient">错过的洽谈</a>
								</div>
								<div style="float: right;">
									<i class="fa fa-clock-o"></i> 
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=1" id="createToday">今日新建</a> |
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=2" id="createWeek">最近7天</a> |
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=3" id="createMonth">本月新建</a> |
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=4" id="recentModify">最近修改</a>
									&nbsp; &nbsp;<i class="fa fa-trash-o"></i> 
									<a href="${request.getContextPath()}/chats/chatsList.do?viewType=5" id="recycle">回收站</a>
								</div>
							</div>
					</div>    
				</div>
				<!--位置提示结束  -->
				<div class="col-md-12">
				     <div class="portlet light bordered">
					    <div class="portlet-body">
						 <form id="frm1" method="post" >
					    	<div class="row">
					    	  <div style="float: left;width:100px; margin-left:15px;">
									<div class="btn-group pull-left">
										<a class="btn green" onclick="batchDelete()">批量删除 </a>
									</div>
							  </div>






							  <div style="float: left;width: 62%">
							   <div style="width:20%;float:left;">
								<select class="form-control" name="attribute" id="attribute" onblur="selectColumn();">
									<option value="id" <#if qc??&&qc.attribute??&&qc.attribute=="id">selected="selected" </#if>>洽谈编号</option>
									<option value="companyName" <#if qc??&&qc.attribute??&&qc.attribute=="companyName">selected="selected" </#if>>企业</option>
									<option value="customerName" <#if qc??&&qc.attribute??&&qc.attribute=="customerName">selected="selected" </#if>>用户名</option>
									<option value="inPool" <#if qc??&&qc.attribute??&&qc.attribute=="inPool">selected="selected" </#if>>客户池</option>
									<option value="ip" <#if qc??&&qc.attribute??&&qc.attribute=="ip">selected="selected" </#if>>IP/地区</option>
									<option value="chatTimes" <#if qc??&&qc.attribute??&&qc.attribute=="chatTimes">selected="selected" </#if>>沟通次数</option>
									<option value="updatedAt" <#if qc??&&qc.attribute??&&qc.attribute=="updatedAt">selected="selected" </#if>>最后沟通时间</option>
									<option value="name" <#if qc??&&qc.attribute??&&qc.attribute=="name">selected="selected" </#if>>最后沟通人</option>
									<option value="status" <#if qc??&&qc.attribute??&&qc.attribute=="status">selected="selected" </#if>>状态</option>
								</select>
							</div>
							<div  style="width:10%;float:left; margin-left:15px;">
								<select class="form-control" name="operator">
									  <option value="1" <#if qc??&&qc.operator??&&qc.operator=="1">selected="selected" </#if>>包含</option>
							          <option value="2" <#if qc??&&qc.operator??&&qc.operator=="2">selected="selected" </#if>>不包含</option>
							          <option value="3" <#if qc??&&qc.operator??&&qc.operator=="3">selected="selected" </#if>>等于</option>
							          <option value="4" <#if qc??&&qc.operator??&&qc.operator=="4">selected="selected" </#if>>不等于</option>
							          <option value="5" <#if qc??&&qc.operator??&&qc.operator=="5">selected="selected" </#if>>开始字符</option>
							          <option value="6" <#if qc??&&qc.operator??&&qc.operator=="6">selected="selected" </#if>>结束字符</option>
							          <option value="7" <#if qc??&&qc.operator??&&qc.operator=="7">selected="selected" </#if>>为空</option>
							          <option value="8" <#if qc??&&qc.operator??&&qc.operator=="8">selected="selected" </#if>>不为空</option>
								</select>
							</div>
							<div class="col-md-3">
								<input type="text" class="form-control" name="content" id="content" value="<#if qc??&&qc.content??>${qc.content}</#if>">
							</div>
							<div class="col-md-2">
									<button  class="btn green">
										<i class="fa fa-search"></i> 搜索 
									</button>

								</div>
								

							</div>
																<div
											style="float: right;width: 28%;text-align: right;padding-right: 18px;">

											<p class="btn green" onclick="chatsExport();">
												<i class="fa fa-file-excel-o"></i> 导出
											</p>
										</div>
						</div>
					</form>
						
						<div class="table-scrollable">
				          		<table class="table table-striped table-bordered table-advance table-hover ttTbl" id="myTable" >
						          	<thead>
										<tr>
											<th class="table-checkbox">
												<input type="checkbox" class="group-checkable" data-set="#myTable .checkboxes"/>
											</th>	
											<th>洽谈编号</th>
											<th>企业</th>
											<th>用户名</th>
											<th>客户池</th>
											<th>IP/地区</th>
											<th>沟通次数</th>
											<th>发起时间</th>
											<th>最后沟通时间</th>
											<th>最后沟通人</th>
											<th>状态</th>
											<th>操作</th>
										</tr>
								</thead>
								<tbody>
										<#list list as chats>
									       <tr class="odd gradeX">
												<td><input name="checkboxes" class="checkboxes" type="checkbox" value="${chats.id}"></td>
												<td>${chats.id}</td>
												<td>${chats.companyName?if_exists}</td>
												<td>${chats.customerName?if_exists}</td>
												<td>${chats.inPool?if_exists}</td>
												<td>${chats.ip?if_exists}</td>
												<td>${chats.chatTimes?if_exists}</td>
												<td>${chats.createdAt?if_exists}</td>
												<td>${chats.updatedAt?if_exists}</td>
												<td>${chats.name?if_exists}</td>
												<td>${chats.status?if_exists}</td>
											
											

												<td style="text-align: center;">
												
													<#if chats.status=="等待洽谈">
													
															<a class="btn btn-xs green"  onclick="continueNegotiate('${request.getContextPath()}/chats/continueNegotiate.do?id=${chats.id}')">继续洽谈</a> 
															<#else>
														<a class="btn btn-xs green"  href="${request.getContextPath()}/chats/chatsLook.do?id=${chats.id}">查看</a> 
															<#if chats.isDel== 0>
																<a class="btn btn-xs green"  onclick="removeConfirm('${request.getContextPath()}/chats/removeChats.do?ids=${chats.id}')">删除</a>
															</#if>
															
															
														</#if>
												 </td>
											</tr>
									</#list>
								  </tbody>
								</table>
						 	</div>		
						  	<div>
						          		<div style="width:80%;margin:0 auto;">
											<div id="kkpager"></div>
											<input type="hidden" value="${totalPage}" id="totalPage">
											<input type="hidden" value="${totalRecords}" id="totalRecords">
										</div>
								</div>
						    </div>
					    </div>
					</div>
				</div>
		</div>
</div>
</div>


					
<!-- END PAGE CONTAINER -->




		




<!-- 底部开始 -->
<#include "/include/foot.html" />
<!-- 底部结束 -->

<!--[if lt IE 9]>
<script src="${request.getContextPath()}/Public/assets/global/plugins/respond.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/excanvas.min.js"></script> 
<![endif]-->
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-notific8/jquery.notific8.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/layout.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/kkpager.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/commonUtils.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/kkpager.min.js" type="text/javascript"></script>
<script>
	jQuery(document).ready(function() {
	   Metronic.init(); // init metronic core componets
	   Layout.init(); // init layout
	   CommonUtils.checkInit();
	   selectColumn();
	});
	
	function selectColumn() {
		var value = $("#attribute").val();
		if (value == "updatedAt") {
			$('#content').bind("click", function(){WdatePicker();});
		} else {
			$('#content').unbind("click");
		}
	}
	//批量删除
	function batchDelete(){
		debugger;
		if("?viewType=5"==window.location.search){
			 CommonUtils.doExecute('${request.getContextPath()}/chats/removeChats.do'); 
		}else{
			 CommonUtils.doExecute('${request.getContextPath()}/chats/delChats.do'); 
		}
	}
	function continueNegotiate(url){
		$.ajax({
					url : url,
					async: false,
					success : function(result) {
							CommonUtils.succModal("提示",result.msg);
					 }
				});  
	}

	//初始化分页插件
	function getParameter(name) { 
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r!=null) return unescape(r[2]); return null;
	}
	
	//init
	$(function(){
		
		var totalPage = $('#totalPage').val();
		var totalRecords = $('#totalRecords').val();
		
		var pageNo = getParameter('pno');
		if(!pageNo){
			pageNo = 1;
		}
		//生成分页
		//有些参数是可选的，比如lang，若不传有默认值
		kkpager.generPageHtml({
			pno : pageNo,
			//总页码
			total : totalPage,
			//总数据条数
			totalRecords : totalRecords,
			
			getLink : function(n){
				return this.hrefFormer + this.hrefLatter + "?pno="+n;
			}	
		});
	});
	
	//导出
	function chatsExport (){
		
		 var ids=CommonUtils.getCheckedBoxs().join(",");
		 var viewType=getQueryString("viewType");
		 var frm1=$("#frm1").serialize();
		 window.location="${request.getContextPath()}/chats/chatsExport.do?ids="+ids+"&viewType="+viewType+"&"+frm1;
	}
	
	//询问是否真的删除
	function  removeConfirm(url){
		CommonUtils.confirm("提示","确定删除此条信息吗?","removeChatsOne('"+url+"')");		 
	}
	
	//获取url参数
	function getQueryString(name) { 
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r != null) return unescape(r[2]); return ""; 
	} 
	
	
	//放入回收站
	function removeChatsOne(url){
		  $.ajax({
				url : url,
				async: false,
				success : function(result) {
						CommonUtils.succModal2("提示",result.msg,window.location);
				 }
			});    
	}
	

	
	

	
	
</script>
</body>
</html>